package com.haixiaoke.saas.workOrder.service.impl;

import java.util.List;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.workOrder.domain.WorkOrder;
import com.haixiaoke.saas.workOrder.domain.WorkOrderRecord;
import com.haixiaoke.saas.workOrder.mapper.WorkOrderRecordMapper;
import com.haixiaoke.saas.workOrder.service.IWorkOrderRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 工单跟进记录Service业务层处理
 *
 * @author qixi
 * @date 2024-09-03
 */
@Service
public class WorkOrderRecordServiceImpl implements IWorkOrderRecordService {
    @Autowired
    private WorkOrderRecordMapper workOrderRecordMapper;

    /**
     * 查询工单跟进记录
     *
     * @param recordId 工单跟进记录主键
     * @return 工单跟进记录
     */
    @Override
    public WorkOrderRecord selectWorkOrderRecordByRecordId(Long recordId) {
        return workOrderRecordMapper.selectWorkOrderRecordByRecordId(recordId);
    }

    /**
     * 查询工单跟进记录列表
     *
     * @param workOrderRecord 工单跟进记录
     * @return 工单跟进记录
     */
    @Override
    public List<WorkOrderRecord> selectWorkOrderRecordList(WorkOrderRecord workOrderRecord) {
        return workOrderRecordMapper.selectWorkOrderRecordList(workOrderRecord);
    }

    /**
     * 新增工单跟进记录
     *
     * @param workOrderRecord 工单跟进记录
     * @return 结果
     */
    @Override
    public int insertWorkOrderRecord(WorkOrderRecord workOrderRecord) {
        workOrderRecord.setCreateTime(DateUtils.getNowDate());
        return workOrderRecordMapper.insertWorkOrderRecord(workOrderRecord);
    }

    /**
     * 修改工单跟进记录
     *
     * @param workOrderRecord 工单跟进记录
     * @return 结果
     */
    @Override
    public int updateWorkOrderRecord(WorkOrderRecord workOrderRecord) {
        return workOrderRecordMapper.updateWorkOrderRecord(workOrderRecord);
    }

    /**
     * 批量删除工单跟进记录
     *
     * @param recordIds 需要删除的工单跟进记录主键
     * @return 结果
     */
    @Override
    public int deleteWorkOrderRecordByRecordIds(Long[] recordIds) {
        return workOrderRecordMapper.deleteWorkOrderRecordByRecordIds(recordIds);
    }

    /**
     * 删除工单跟进记录信息
     *
     * @param recordId 工单跟进记录主键
     * @return 结果
     */
    @Override
    public int deleteWorkOrderRecordByRecordId(Long recordId) {
        return workOrderRecordMapper.deleteWorkOrderRecordByRecordId(recordId);
    }

    @Override
    public List<WorkOrderRecord> selectWorkOrderRecordByWorkOrderId(String workOrderId) {
        return workOrderRecordMapper.selectWorkOrderRecordByWorkOrderId(workOrderId);
    }

    @Override
    public WorkOrderRecord selectWorkOrderRecordByRecordTypeAndUserDisplayType(String workOrderId, String recordType, String userDisplayType) {
        return workOrderRecordMapper.selectWorkOrderRecordByRecordTypeAndUserDisplayType(workOrderId, recordType, userDisplayType);
    }

    @Override
    public List<WorkOrderRecord> selectWorkOrderRecordByRecordType(String workOrderId, String recordType) {
        return workOrderRecordMapper.selectWorkOrderRecordByRecordType(workOrderId, recordType);
    }


    @Override
    public int insertBatchWorkOrderRecord(List<WorkOrderRecord> workOrderRecordList) {
        return workOrderRecordMapper.insertBatchWorkOrderRecord(workOrderRecordList);
    }
}
